<template>
	<view class="login_layout">
		<image class="user_image" src="https://img.yzcdn.cn/vant/empty-image-default.png" mode=""></image>
		<text class="login_text">{{obj.text}}</text>
		<button v-show="obj.button" size="mini" class="login_button" type="button"
			@click="toLogin">{{obj.button}}</button>
	</view>
</template>

<script setup>
	import useUserStore from '@/store/modules/user.js'

	let { obj } = defineProps({
		obj: {
			type: Object,
			default () {
				return {
					text: '您尚未登录，点击登录获取更多权益',
					button: '去登陆',
					url: '/pages/login/login',
					toTabbar: false
				}
			}
		}
	})

	let userStore = useUserStore()

	// 跳转按钮
	const toLogin = () => {
		if (obj.toTabbar) {
			uni.switchTab({
				url: obj.url
			})
		} else {
			uni.navigateTo({
				url: obj.url
			})
		}
	}
</script>

<style lang="scss" scoped>
	.login_layout {
		margin-top: 40rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;

		.user_image {
			width: 280rpx;
			height: 280rpx;
		}

		.login_text {
			margin: 20rpx 0;
			color: rgba(185, 185, 185, 1.0);
			font-size: 30rpx;
		}

		.login_button {
			margin-top: 10rpx;
			color: rgba(255, 255, 255, 1);
			background-color: #ff0000;
			border-radius: 50rpx;
		}
	}
</style>